package com.pc.service.serviceImpl;

import com.pc.common.Result;
import com.pc.feign.StudentFeign;
import com.pc.model.Student;
import com.pc.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements IUserService {
    @Autowired
    StudentFeign studentFeign;

    @Override
    public String getUsername() {
        return "";
    }

    @Override
    public List<Student> getStudent() {
        Result studentName = studentFeign.getStudentName();
        Object data = studentName.getData();
        List<Student> students = (List<Student>) data;
        return students;
    }

    @Override
    public Student getStudentById(Long id) {
        Result studentById = studentFeign.getStudentById(id);
        return (Student) studentById.getData();
    }
}
